package com.tbit.uqbike.compalint.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * 客诉协商历史
 *
 * @author <a href="mailto:zhang.zhiliang@tbit.com.cn">Zhang ZhiLiang</a>
 * @version 1.0
 * @see <a href="http://adsl1.tbit.com.cn:21490/pages/viewpage.action?pageId=82182491">订单号规范</a>
 * @since 2025/2/14
 */
@Data
public class ComplaintHistoryVO {
    /**发送方*/
    private String sender;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    /**发送时间*/
    private LocalDateTime sendTime;
    /**发送内容*/
    private String content;
    /**图片url字符串 分隔符 ; */
    @JsonIgnore
    private String picture;
    /**图片链接列表*/
    private List<String> pictureUrls;
    /**是否平台管理方*/
    private Boolean adminFlag;

    /**
     * 格式化返回值
     */
    public void format() {
        if (Objects.isNull(picture)){
            return ;
        }
        // 图片路径切割
        String[] urls = picture.split(";");
        pictureUrls = Arrays.asList(urls);
    }
}
